package com.gitee.dupe.file.strategy;

import com.gitee.dupe.file.entity.Attachment;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;


/**
 * 文件策略接口
 *
 * @author LYH
 */
public interface FileStrategy {
    /**
     * 文件上传
     *
     * @param file 文件
     * @return 文件对象
     */
    Attachment upload(MultipartFile file);

    /**
     * 下载文件
     *
     * @param request
     * @param response
     * @param attachments
     * @return
     */
    void download(HttpServletRequest request, HttpServletResponse response, List<Attachment> attachments);

    /**
     * 删除文件
     *
     * @param attachments
     */
    void delete(List<Attachment> attachments);
}
